//
//  ZApi.h
//  ZFramework
//
//  Created by liuchengbin on 15/5/9.
//  Copyright (c) 2015年 liuchengbin. All rights reserved.
//

#import <Foundation/Foundation.h>
#import "ZHttpClient.h"
#import "ZShare.h"

@interface ZApi : NSObject

+ (instancetype)SharedZApi;
+(BOOL) isConnectionAvailable;
+ (void)checkNetWorkStatus;
-(void)cancel;
/**
 * 普通请求
 */
- (void)requestWithURL:(NSString *)url
                 paras:(NSDictionary *)parasDict
                  type:(ZHttpResponseType)type
       allowFetchCache:(BOOL)allowFetchCache
               success:(void(^)(AFHTTPRequestOperation* operation, NSObject *resultObject))success
               failure:(void(^)(NSError *requestErr))failure ;
/**
 * 带header信息的请求
 */
- (void)requestWithURL2:(NSString *)url
                referer:(NSString *)refer
                  paras:(NSDictionary *)parasDict
                   type:(ZHttpResponseType)type
        allowFetchCache:(BOOL)allowFetchCache
                success:(void(^)(AFHTTPRequestOperation* operation, NSObject *resultObject))success
                failure:(void(^)(NSError *requestErr))failure;
/**
 * 多张图片上传
 */
- (void)uploadImagesWithURL:(NSString *)url
                      paras:(NSDictionary *)parasDict
                     images:(NSArray*)images
                    success:(void(^)(AFHTTPRequestOperation* operation, NSObject *resultObject))success
                    failure:(void(^)(NSError *requestErr))failure
             uploadProgress:(void(^)(NSUInteger bytesWritten, long long totalBytesWritten, long long totalBytesExpectedToWrite))uploadProgress;
/**
 * 单张图片上传
 */
- (void)uploadIconWithURL:(NSString *)url
                      paras:(NSDictionary *)parasDict
                     image:(UIImage*)image
                    success:(void(^)(AFHTTPRequestOperation* operation, NSObject *resultObject))success
                    failure:(void(^)(NSError *requestErr))failure
             uploadProgress:(void(^)(NSUInteger bytesWritten, long long totalBytesWritten, long long totalBytesExpectedToWrite))uploadProgress;
//
- (void)uploadImagesWithURL:(NSString *)url
                      paras:(NSDictionary *)parasDict
                      cover:(UIImage*)cover
                     images:(NSArray*)images
                    success:(void(^)(AFHTTPRequestOperation* operation, NSObject *resultObject))success
                    failure:(void(^)(NSError *requestErr))failure
             uploadProgress:(void(^)(NSUInteger bytesWritten, long long totalBytesWritten, long long totalBytesExpectedToWrite))uploadProgress;
@end
